<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.wanghua.spring.bean.entity.VisitOnline" %>
<%@ page import="java.util.List" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.wanghua.spring.util.StringUtil" %>
<html>
<head>
    <title>在线用户</title>
</head>
<body>
<div style="margin-top:10px;margin-buttom:10px;">${pagination}</div>
<div class="list">
    <table>
        <%
            List<VisitOnline> detailList=(List<VisitOnline>) request.getAttribute("onlineList");
            DateFormat dateFormat =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            for(int i=0;detailList!=null&&i<detailList.size();i++) {
                VisitOnline d = detailList.get(i);

                out.println("<tr class='" + (i % 2 == 0 ? "even" : "odd") + "'>");
                out.println("   <td>" + d.getId() + "</td>");
                out.println("   <td>" + d.getUserid() + "</td>");
                out.println("   <td>" + d.getIp() + "</td>");
                out.println("   <td>" + d.getAddress() + "</td>");
                out.println("   <td>" + d.isOnline() + "</td>");
                out.println("   <td>" + d.getActiveTimes() + "</td>");

                if (!StringUtil.isNull(d.getUrl())) {
                    out.println("   <td><span style='width:100px;overflow:hidden;' title='" + d.getTitle() + "'><a href=\"" + d.getUrl() + "\" target=_blank>" + d.getTitle() + "</a></span></td>");
                } else {
                    out.println("   <td>&nbsp;</td>");
                }

                out.println("   <td>" + d.getScreenWidth() + "*" + d.getScreenHeight() + "</td>");
                out.println("   <td>" + d.getColorDepth() + "</td>");
                out.println("   <td>" + d.getAppName() + "&nbsp;</td>");
                out.println("   <td>" + d.getSystemLanguage() + "&nbsp;</td>");
                out.println("   <td><span style='width:100px;overflow:hidden;' title='" + d.getUserAgent() + "'>" + d.getUserAgent() + "</span></td>");
                out.println("   <td>" + dateFormat.format(d.getStartDate()) + "</td>");
                out.println("   <td>" + dateFormat.format(d.getLastActiveDate()) + "</td>");
                out.println("</tr>");
            }
        %>
    </table>
</div>
<div style="margin-top:10px;margin-bottom:10px;">${paginatin}</div>
<script type="text/javascript" src="/status.jsp"></script>
</body>
</html>
